<template>
  <div class="cart">
    <search-cart class="searchCart"></search-cart>
    <xiang-yun class="xiangYun"></xiang-yun>
    <buy-list class="buyList" @getData="getTitle" :list="dataList"></buy-list>
    


    <div style="height: 1000px;"></div>
  </div>
</template>

<script>
import SearchCart from '../../../components/Cart/SearchCart.vue'
import XiangYun from '../../../components/Cart/XiangYun.vue'
import BuyList from '../../../components/Cart/BuyList.vue'



export default {
  name: 'cart',
  components: {
    // 前面是真实組件，後面是組件的一个任意名字与import后面的那个SearchBar名字保持相同;也可以只写一个中间,号隔开
    SearchCart:SearchCart,
    XiangYun:XiangYun,
    BuyList:BuyList
    
   
  },
  data() {
    return {
      dataList:[] //1、后台给我的数据都是存放在data里面的，而且属于的是大父组件里面的;必须先声明,否则mounted里的this.dataList找不到存放位置就会直接报错              
    }
  },
  mounted() {
    setTimeout(()=>{
      this.dataList = [
        {
          backgrond:require("../../../assets/images/forumProducts/1printer.jpg"), //如果这里出不来多数都是少了require这个必须项
          shopDes:"1.2万粉丝"
        },
        {
          backgrond:require("../../../assets/images/forumProducts/2paper.jpg"),
          shopDes:"2.5万粉丝"

        },
        {
          backgrond:require("../../../assets/images/forumProducts/3computer.jpg"),
          shopDes:"10万粉丝"
        },
        {
          backgrond:require("../../../assets/images/forumProducts/4desk.jpg"),
          shopDes:"50万粉丝"

        },
        {
          backgrond:require("../../../assets/images/forumProducts/5sofa.jpg"),
          shopDes:"3.6万粉丝"
        },
        {
          backgrond:require("../../../assets/images/forumProducts/6photobook.jpg"),
          shopDes:"4.2万粉丝"

        },
        {
          backgrond:require("../../../assets/images/forumProducts/7fridge.jpg"),
          shopDes:"6.6万粉丝"

        },
        {
          backgrond:require("../../../assets/images/forumProducts/8microoven.jpg"),
          shopDes:"110万粉丝"

        },
        {
          backgrond:require("../../../assets/images/forumProducts/9washer.jpg"),
          shopDes:"26万粉丝"

        },
        {
          backgrond:require("../../../assets/images/forumProducts/10tv.jpg"),
          shopDes:"300万粉丝"

        }
      ]
    },1000)
},
methods: {
  getTitle(data){      //5.拿到这个函数的值输出
    console.log(data);
  }
},


} 
</script>

<style lang="less" scoped>
  .cart{
    background-color: #ffffff;
  }
</style>